<?php

namespace app\admin\controller\official;

use app\common\controller\Backend;
use think\Db;

/**
 * 订单管理
 *
 * @icon fa fa-user
 */
class Recharge extends Backend
{

    protected $relationSearch = true;


    /**
     * @var \app\admin\model\User
     */
    protected $model = null;
   
    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 查看
     */
    public function index()
    {
        //设置过滤方法
        $this->request->filter(['strip_tags']);
        if ($this->request->isAjax()) {
            //如果发送的来源是Selectpage，则转发到Selectpage
            if ($this->request->request('keyField')) {
                return $this->selectpage();
            }
            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
            $total = Db::name('recharge_order')
                ->where($where)
                ->order($sort, $order)
                ->field('id')
                ->count();
            $list = Db::name('recharge_order')
                ->where($where)
                ->order($sort, $order)
                ->limit($offset, $limit)
                // ->field('id,last_login,mobile,login_num,last_ip,openid,create_time')
                ->select();
            $result = array("total" => $total, "rows" => $list);

            return json($result);
        }
        return $this->view->fetch();
    }
}
